/** 
 * Utilities.java
 * @author Lex
 * 2007-9-5 ����06:20:53
 */
package org.lex.ftp.util;

public class Utilities {
	public static String formatTime(long millisTime) {
		millisTime /= 1000L;
		if (millisTime < 60L)
			return "00:" + Utilities.format(millisTime);
		int sec = (int) millisTime % 60;
		millisTime /= 60L;
		if (millisTime < 60L)
			return Utilities.format(millisTime) + ":" + Utilities.format(sec);
		int min = (int) millisTime % 60;
		millisTime /= 60;
		return Utilities.format(millisTime) + ":" + Utilities.format(min) + ":" + Utilities.format(sec);
	}

	private static String format(long value) {
		if (value > 9)
			return Long.toString(value);
		else
			return "0" + value;
	}
}
